package com.example.config;

import com.example.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {

    @Autowired
    TokenInterceptor tokenInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(tokenInterceptor).addPathPatterns("/**")
                .excludePathPatterns("/passport/token/create")
                .excludePathPatterns("/front/analysis/**")
                .excludePathPatterns("/swagger-ui/**","/passport/userAdmin/getUserTenantAgreement","/voice/**", "/swagger-resources/**", "/v2/api-docs/**",
                        "/Home/ai/httpost","/front/incident/create","/front/messageLogging/list","/front/incident/pushMessage");

    }
}